package com.lanqiao.javaparkinglot.controller;

import com.lanqiao.javaparkinglot.common.CommonResult;
import com.lanqiao.javaparkinglot.entity.Yghs;
import com.lanqiao.javaparkinglot.service.YghsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


@RestController
@RequestMapping("/yghs")
public class YghsController {
    @Autowired
    YghsService yghsService;
    //查询
    @GetMapping("/cha")
    public CommonResult findyghs (Yghs yghs){
        List<Yghs> yghsList=yghsService.findYghs();
        return CommonResult.success("员工核酸表查询",yghsList);
    }
    //添加
    @PostMapping("/tianjia")
    public CommonResult addyghs (@RequestBody Yghs yghs){
        yghsService.addyghs(yghs);
        return CommonResult.success("数据添加成功");

    }
    //修改
    @PutMapping("/xiugai")
    public CommonResult updateyghs(@RequestBody Yghs yghs){
        yghsService.updateyghs(yghs);
        return CommonResult.success("数据修改成功");
    }
    //删除
    @DeleteMapping("/{hsy_id}")
    public CommonResult deleteyghs (@PathVariable ("hsy_id")Long hsy_id){
        yghsService.deleteyghs(hsy_id);
        return CommonResult.success("删除成功");

    }
}
